<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sorts the fields in the document</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="solrdocument.set.html">« SolrDocument::__set</a></li>
      <li style="float: right;"><a href="solrdocument.toarray.html">SolrDocument::toArray »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.solrdocument.html">SolrDocument</a></li>
    <li>Sorts the fields in the document</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="solrdocument.sort" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SolrDocument::sort</h1>
  <p class="verinfo">(PECL solr &gt;= 0.9.2)</p><p class="refpurpose"><span class="refname">SolrDocument::sort</span> &mdash; <span class="dc-title">Sorts the fields in the document</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-solrdocument.sort-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>SolrDocument::sort</strong></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$sortOrderBy</code></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$sortDirection</code><span class="initializer"> = SolrDocument::SORT_ASC</span></span>): <span class="type">bool</span></div>

  <p class="para rdfs-comment">
 <div class="descriptioncode"><pre class="descriptioncode">The fields are rearranged according to the specified criteria and sort direction
   
   Fields can be sorted by boost values, field names and number of values.
   
   The sortOrderBy parameter must be one of :
   
   * SolrDocument::SORT_FIELD_NAME
   * SolrDocument::SORT_FIELD_BOOST_VALUE
   * SolrDocument::SORT_FIELD_VALUE_COUNT
   
   The sortDirection can be one of :
   
   * SolrDocument::SORT_DEFAULT
   * SolrDocument::SORT_ASC
   * SolrDocument::SORT_DESC
   
   The default way is to sort in ascending order.</pre>
</div>
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-solrdocument.sort-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">sortOrderBy</code></dt>

     <dd>

      <p class="para">
       The sort criteria.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">sortDirection</code></dt>

     <dd>

      <p class="para">
       The sort direction.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-solrdocument.sort-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>true</code></strong>， 或者在失败时返回 <strong><code>false</code></strong>。
  </p>
 </div>


</div></div></div></body></html>